//
//  LzwHostTableCell.m
//  NewHalfsugar
//
//  Created by 刘志武 on 16/1/2.
//  Copyright © 2016年 刘志武. All rights reserved.
//

#import "LzwHostTableCell.h"
#import "LzwBaseImageView.h"
#import "LzwBaseLable.h"
#import "UIImageView+WebCache.h"

@interface LzwHostTableCell ()

@property (nonatomic, retain) LzwBaseImageView *myImageHost;
@property (nonatomic, retain) LzwBaseImageView *myImageHost1;

@property (nonatomic, retain) LzwBaseLable *myLableHost;
@property (nonatomic, retain) LzwBaseLable *myLableHost1;

@end

@implementation LzwHostTableCell


-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    if (self) {
        [self creatHost];
    }
    return self;
}

-(void)creatHost{
    
    //图片
    self.myImageHost = [[LzwBaseImageView alloc]initWithFrame:CGRectMake(3 * WIDTH, 3 * WIDTH, 370 * WIDTH, 180 * WIDTH)];
    self.myImageHost.backgroundColor = [UIColor whiteColor];
    [self.contentView addSubview:self.myImageHost];
    
    //喜爱图片
    self.myImageHost1 = [[LzwBaseImageView alloc]initWithFrame:CGRectMake((375 - 20) / 2 - 70 * WIDTH, 230 * WIDTH, 20 * WIDTH, 20 * WIDTH)];
    self.myImageHost1.image = [UIImage imageNamed:@"love.png"];
    [self.contentView addSubview:self.myImageHost1];
    
    //描述
    self.myLableHost = [[LzwBaseLable alloc]initWithFrame:CGRectMake(2 * WIDTH, 185 * WIDTH, 369 * WIDTH, 45 * WIDTH)];
    self.myLableHost.textColor = [UIColor lightGrayColor];
    self.myLableHost.font = [UIFont systemFontOfSize:16 * WIDTH];
    self.myLableHost.textAlignment = NSTextAlignmentCenter;
    [self.contentView addSubview:self.myLableHost];
    
    //喜爱人数
    self.myLableHost1 = [[LzwBaseLable alloc]initWithFrame:CGRectMake((375 - 20) / 2 - 50 + 5 * WIDTH, 230 * WIDTH, 60 * WIDTH, 20 * WIDTH)];
    self.myLableHost1.textColor = [UIColor lightGrayColor];
    self.myLableHost1.font = [UIFont systemFontOfSize:16 * WIDTH];
    self.myLableHost1.textAlignment = NSTextAlignmentCenter;
    [self.contentView addSubview:self.myLableHost1];
    
    [_myImageHost release];
    [_myImageHost1 release];
    [_myLableHost release];
    [_myLableHost1 release];
    
}

-(void)setModleHost:(LzwHostModle *)modleHost{
    
    if (_modleHost != modleHost) {
        [_modleHost release];
        _modleHost = [modleHost retain];
    }
    
    self.myLableHost.text = self.modleHost.title;
    self.myLableHost1.text = self.modleHost.likes;
    
    NSURL *url = [NSURL URLWithString:self.modleHost.pic];
    
    [self.myImageHost sd_setImageWithURL:url placeholderImage:nil];
}




@end
